<template>
  <div class="footer">
    <!-- 添加的分割线 -->
    <div class="divider"></div>
    <div class="footer-content">
      <div class="footer-item">
        <span class="contact-link" @click="showAboutDialog = true">关于我们</span>
      </div>
      <div class="footer-item">
        <span class="contact-link" @click="showContactDialog = true">联系方式</span>
      </div>
      <div class="footer-item copyright">
        © 2025 贝贝回家 版权所有
      </div>
    </div>
  </div>

  <!-- 弹窗部分保持不变 -->
  <div v-if="showAboutDialog" class="custom-dialog">
    <div class="dialog-overlay" @click="showAboutDialog = false"></div>
    <div class="dialog-content">
      <div class="dialog-header">
        关于贝贝回家
        <button class="dialog-close" @click="showAboutDialog = false">×</button>
      </div>
      <div class="dialog-body">
        <p>贝贝回家宠物领养中心成立于2022年9月1日</p>
        <p>地址：广东省佛山市顺德区大良街道德胜东路顺德职业技术学院</p>
        <p>我们致力于为流浪动物寻找温暖的家，提供专业的领养服务和宠物健康咨询。</p>
      </div>
    </div>
  </div>

  <div v-if="showContactDialog" class="custom-dialog">
    <div class="dialog-overlay" @click="showContactDialog = false"></div>
    <div class="dialog-content">
      <div class="dialog-header">
        联系方式
        <button class="dialog-close" @click="showContactDialog = false">×</button>
      </div>
      <div class="dialog-body">
        <p>我们的联系电话是: 131xxxx1122</p>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const showAboutDialog = ref(false);
const showContactDialog = ref(false);
</script>

<style scoped>
.footer {
  padding: 15px 0;
  margin-top: 30px;
  color: #f0ede4;
  text-align: center;
  position: relative;
}

/* 新增的分割线样式 */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9c8c8, transparent);
  width: 80%;
  margin: 0 auto 20px;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  flex-wrap: wrap;
}

.footer-item {
  flex: 1;
  text-align: center;
}

.footer-item a,
.contact-link {
  color: #000000;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
  font-size: 1rem;
}

.footer-item a:hover,
.contact-link:hover {
  color: #d4a373;
}

.copyright {
  color: #888;
  font-size: 0.85rem;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    gap: 15px;
  }

  .footer-item {
    text-align: center;
  }
  
  /* 移动端分割线调整 */
  .divider {
    width: 90%;
  }
}

/* 自定义弹窗样式（保持不变） */
.custom-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.dialog-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  cursor: pointer;
}

.dialog-content {
  background-color: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  width: 350px;
  max-width: 90%;
  color: #333;
  text-align: center;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 1.3rem;
  font-weight: 600;
  color: #4a7c59;
}

.dialog-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  transition: color 0.2s;
}

.dialog-close:hover {
  color: #ff4444;
}

.dialog-body {
  line-height: 1.7;
}

.dialog-body p {
  margin-bottom: 15px;
}
</style>